<template>
    <div class="page">
        <van-nav-bar
  title="个人中心"

  right-text="编辑信息"
  
    :style="{backgroundColor:'rgb(216 190 253)',color:'white'} "
  @click-right="onClickRight"
/>
        <!-- <p v-for="(v,index) in abc" :key="index">{{index+1+"、"+v}}</p> -->
        <img :src="getInfo.avaUrl">
        <p>{{getInfo.name}}</p>
         <van-cell-group>
        <van-cell title="昵称" :value="getInfo.name" />
        <van-cell title="年龄" :value="getInfo.age" />
         <van-cell title="性别" :value="gender" />
        <van-cell title="手机号" :value="getInfo.phone" />
        <br>
        <br>
        

       <van-button type="primary" block @click="logout" color="linear-gradient(to right, #ff6034, #ee0a24)">退出</van-button>
 <br>
 <van-button type="primary" block @click="todo" color="linear-gradient(to right, #ff6034, #ee0a24)">todolist</van-button>
</van-cell-group>

    </div>
</template>
<script>
import Url from '../tools/Url'
import { Toast } from 'mint-ui';
export default {
    name:'page',
    props:["abc"],
    data(){
        return{
           
        }
    },
    computed: {
        getInfo(){
            return this.$store.state.info;
        },
        gender(){
            var gender
            if(this.$store.state.info.gender == 1){
                gender = "男";
            }else{
                gender = "女";
            }
            return gender
        }
    },
    methods:{
        logout(){
            var token = sessionStorage.getItem("token");
            console.log(token);
            var str = `token=${token}`;
            this.axios.post(Url.WODE_UPL,str).then(res=>{
                console.log(res);
                if(res.data.code==200){
                    sessionStorage.removeItem("token");
                    this.$router.push("/rester");
                }else{
                    Toast(res.data.message);
                }
            })

            
        },
     onClickRight() {
      this.$router.push("/my");
    },
    todo(){
        rhis.$router.push("/todolist");
    }
    }
}
</script>
<style scoped>
.page{
    text-align: center;
  width: 100%;
  height: 100%;
  
    background-color:  #fbfef9!important ;
   
}

.van-cell-group{
    background-color:  #fbfef9!important ;
}
.van-cell{
    background-color:  #fbfef9!important ;
}
.van-nav-bar__title{
    color: white !important;
}
</style>